package net.georel.representation.categorisation.decisionanalysis;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public class ElementaryInformationProcesses {

	public enum EIP{READ, DECIDE, COMPARE, PRODUCT, ADD, DIFFERENCE, ELIMINATE, MOVE};
	private EIP eIP;
	private int totalEIPs = 0;
	private double totalWeightEIPs = 0.0;
	private final double readWeight = 0.3;
	private final double decideWeight = 0.3;
	private final double compareWeight = 0.3;
	private final double productWeight = 1.1;
	private final double addWeight = 1.1;
	private final double differenceWeight = 0.3;
	private final double eliminateWeight = 0.4;
	private final double moveWeight = 0.23;
	private List<EIP> eipSet = new ArrayList<EIP>();
	//weights above taken from :-
	//Johnson, E. J. & Payne, J. W. 1985. Effort and Accuracy in Choice. Management Science, 31(4), 395-414.
	//page 405
	

	public void addEIP(EIP eIP){
		eipSet.add(eIP);
	}
	
	public int getTotalEIPs() {
		Iterator<EIP> eipIt = eipSet.iterator();
		EIP eip;
		while(eipIt.hasNext()){
			eip = eipIt.next();
			totalEIPs+=1;
		}
		
		return totalEIPs;
		
	}
	
	public double getTotalWeightedEIPs() {
		Iterator<EIP> eipIt = eipSet.iterator();
		EIP eip;
		while(eipIt.hasNext()){
			eip = eipIt.next();
			
			switch(eip){
			case ADD: totalWeightEIPs+=addWeight;break;
			case DECIDE: totalWeightEIPs+=decideWeight;break;
			case PRODUCT: totalWeightEIPs+=compareWeight;break;
			case COMPARE: totalWeightEIPs+=productWeight;break;
			case DIFFERENCE: totalWeightEIPs+=differenceWeight;break;
			case ELIMINATE: totalWeightEIPs+=eliminateWeight;break;
			case MOVE: totalWeightEIPs+=moveWeight;break;
			case READ: totalWeightEIPs+=readWeight;break;
			}
			
		}
		
		return totalWeightEIPs;
		
	}
	

	public void clearEIPs(){
		eipSet.clear();
	}
	
	
}
